<%@ Page Language="C#" MasterPageFile="~/MasterPageMcSigAdmin.master" AutoEventWireup="true"
    CodeFile="SigPlanProgramaListado.aspx.cs" Inherits="SigPlanProgramaListado" Title="Untitled Page" %>

<%@ Register Assembly="FUA" Namespace="Subgurim.Controles" TagPrefix="cc2" %>

<%@ Register Assembly="UsrControls" Namespace="UsrControls" TagPrefix="cc1" %>
<%@ Register Assembly="Anthem" Namespace="Anthem" TagPrefix="anthem" %>  
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView.Export" tagprefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script language="javascript" type="text/javascript">
    function OnGridSelectionChanged() {
    var counter = document.getElementById("selCount");
    if(counter != null) 
    setInnerText(counter, ctl00_ContentPlaceHolder1_gridPlanesProgramas.GetSelectedRowCount().toString());
    
    ctl00_ContentPlaceHolder1_gridPlanesProgramas.GetSelectedFieldValues('PRG_NOMBRE', OnGridSelectionComplete);
}
function OnGridSelectionComplete(values) {
    selList.BeginUpdate();
    selList.ClearItems();
    for(var i = 0; i < values.length; i ++) {
        selList.AddItem(values[i]);
    }
    selList.EndUpdate();
}
function setInnerText(element, text) { 
    if(typeof element.textContent != 'undefined') { 
        element.textContent = text; 
    } 
    else if (typeof element.innerText != 'undefined') { 
        element.innerText = text; 
    } 
    else if (typeof element.removeChild != 'undefined') { 
        while (element.hasChildNodes()) { 
            element.removeChild(element.lastChild); 
        } 
        element.appendChild(document.createTextNode(text)); 
    } 
}

function confirmEdit()
{
var counter = ctl00_ContentPlaceHolder1_gridPlanesProgramas.GetSelectedRowCount();

if (counter > 1)
    {
    counter = 0;
        alert("Debe seleccionar un solo registro");
        return(false);
    }
    else if (counter == 1)
    {
    counter = 0;
        return(true);
    }
    else if (counter == 0)
    {
    counter = 0;
    alert("Debe seleccionar al  menos un registro");
        return(false);
    }
}
function delete_PreCallBack(button) 
{
var counter = ctl00_ContentPlaceHolder1_gridPlanesProgramas.GetSelectedRowCount();

if (counter > 0)
    {
        return confirm ('Esta seguro de eliminar los registros seleccionados?')
    }
  alert("Debe seleccionar por lo menos un registro");
    return(false);
  
}

function confirmDelete () 
{ 
		var frm;
		
		if (arguments.length > 0)
		{
			frm = arguments[0];
		}
		else
		{
			frm =document.forms[0];
		}



    // loop through all elements
    for (i=0; i<frm.length; i++) 
    {
        // Look for our checkboxes only
        if (frm.elements[i].name.indexOf("chkId") !=-1) 
        {
            // If any are checked then confirm alert, otherwise nothing happens
            if(frm.elements[i].checked) 
            {
                return confirm ('Esta seguro de eliminar los registros seleccionados?')
            }
        }
    }
    alert("Debe seleccionar por lo menos un registro");
    return(false);
}
    </script>
<h1 class="planes">Planes y Programas</h1>
   
                <div runat="server" id="pnlOpcional" visible="false">
                    &nbsp;Filas Seleccionadas: <a id="selCount" type="text/plain" visible="false">0</a>&nbsp;<br />
                    <dxe:ASPxListBox ID="ASPxListBox1" ClientInstanceName="selList" EnableClientSideAPI="true"
                        runat="server" Height="26px" Width="1125px" Visible="true">
                    </dxe:ASPxListBox>
                    <anthem:TextBox ID="txtidUsuario" runat="server" Visible="False" AutoUpdateAfterCallBack="True">8</anthem:TextBox>
                </div>
            
                <anthem:Label ID="lblMensaje" runat="server" AutoUpdateAfterCallBack="True" UpdateAfterCallBack="True"></anthem:Label>
       
                <cc1:WccAcciones ID="WccAcciones1" runat="server" DeleteEnableCallBack="True" CssClass="toolbar" DeletePreCallBackFunction="delete_PreCallBack"
                    OnDelete_OnClick="WccAcciones1_Delete_OnClick" AddCausesValidation="False" AddEnableCallBack="False"
                    UpdateCausesValidation="False" UpdateEnableCallBack="False" UpdateOnClickFunction="return confirmEdit();"
                    OnAdd_OnClick="WccAcciones1_Add_OnClick" ArchiveVisible="False" AuditVisible="False"
                    DeclineVisible="False" PublishVisible="False" ValidateVisible="False" OnUpdate_OnClick="WccAcciones1_Update_OnClick" OnPublish_OnClick="WccAcciones1_Publish_OnClick">
                </cc1:WccAcciones><table class="tabs">
                    <tr>
                        <td class="tab-inactivo" style="height: 20px">
                            <anthem:LinkButton ID="lnkPlanPrograma" runat="server" CausesValidation="False" EnableCallBack="False" OnClick="lnkPlanPrograma_Click" OnClientClick="return c();">Plan Programa</anthem:LinkButton></td>
                        <td id="td2" runat="server" class="tab-inactivo" style="height: 20px" visible="true">
                            <anthem:LinkButton ID="lnkEjecucion" runat="server" CausesValidation="False"
                                EnableCallBack="False" Enabled="true" OnClick="lnkEjecucion_Click" OnClientClick="return confirmEdit();">EJECUCION</anthem:LinkButton></td>
                        <td id="td3" runat="server" align="center" class="tab-inactivo" style="width: 100px;
                            height: 20px" visible="true">
                            <anthem:LinkButton ID="LnkCofinanciacion" runat="server" CausesValidation="False"
                                EnableCallBack="False" Enabled="true" OnClick="LnkFormacionAcademica_Click" OnClientClick="return confirmEdit();">COFINANCIACION</anthem:LinkButton></td>
                        <td id="td4" runat="server" class="tab-inactivo" style="height: 20px" visible="false">
                            <anthem:LinkButton ID="lnkPublicacionesRelevantes" runat="server" CausesValidation="False"
                                EnableCallBack="False" Enabled="true">Otros</anthem:LinkButton></td>
                    </tr>
                </table>

                
            
                <anthem:Panel ID="Panel1" runat="server" AutoUpdateAfterCallBack="True" Width="100%">
                    <dxwgv:ASPxGridView ID="gridPlanesProgramas" runat="server" CssFilePath="~/App_Themes/PlasticBlue/{0}/styles.css"
                        CssPostfix="PlasticBlue" AutoGenerateColumns="False" KeyFieldName="SPZ_ID"
                        Width="100%" Theme="PlasticBlue" >
                      
                        <Styles CssFilePath="~/App_Themes/PlasticBlue/{0}/styles.css" CssPostfix="PlasticBlue">
                            <Header ImageSpacing="10px" SortingImageSpacing="10px">
                            </Header>
                            <SelectedRow BackColor="Navy" Font-Bold="True" ForeColor="Navy">
                            </SelectedRow>
                        </Styles>
                        <Columns>
                            <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                                <ClearFilterButton Visible="True">
                                </ClearFilterButton>
                            </dxwgv:GridViewCommandColumn>
                            <dxwgv:GridViewDataHyperLinkColumn Caption="Imagenes" Visible="False" VisibleIndex="1"
                                Width="60px">
                                <DataItemTemplate>
                                    <anthem:LinkButton ID="lnkImagenesAnthem" runat="server" AutoUpdateAfterCallBack="True"
                                        CommandName="verImagenes">Ver Imagenes</anthem:LinkButton>
                                </DataItemTemplate>
                                <HeaderStyle Wrap="True" />
                            </dxwgv:GridViewDataHyperLinkColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Programa" FieldName="GPR_NOMBRE" VisibleIndex="1">
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Proyecto" FieldName="PRG_NOMBRE" VisibleIndex="2">
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Descripci&#243;n" FieldName="PRG_DESCRIPCION" VisibleIndex="4" Width="200px">
                                <CellStyle Wrap="True">
                                </CellStyle>
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Departamento" FieldName="ZON_NOMBRE_PADRE"
                                VisibleIndex="3" Width="100px">
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Municipio" FieldName="ZON_NOMBRE" VisibleIndex="5">
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataTextColumn Caption="A&#241;o" FieldName="PRG_ANO" VisibleIndex="6"
                                Width="50px">
                                <HeaderStyle Wrap="True" />
                                <CellStyle Wrap="True">
                                </CellStyle>
                                <FooterCellStyle Wrap="True">
                                </FooterCellStyle>
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Poblaci&#243;n" FieldName="PRG_POBLACION_BENEFICIADA"
                                VisibleIndex="7" Width="50px">
                                <PropertiesTextEdit DisplayFormatString="{0:N0}">
                                </PropertiesTextEdit>
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Valor" FieldName="PRG_VALOR_EJECUCION" VisibleIndex="8"
                                Width="100px">
                                <PropertiesTextEdit DisplayFormatString="{0:N2}">
                                </PropertiesTextEdit>
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Cantidad" FieldName="PRG_CANTIDAD" VisibleIndex="9"
                                Width="50px">
                                <PropertiesTextEdit DisplayFormatString="{0:N0}">
                                </PropertiesTextEdit>
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Observaciones" FieldName="PRG_OBSERVACIONES"
                                Visible="False" VisibleIndex="10">
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataHyperLinkColumn Caption="Cofinanciaci&#243;n" Visible="False"
                                VisibleIndex="11">
                                <DataItemTemplate>
                                    <anthem:LinkButton ID="lnkCofinanciacion" runat="server" AutoUpdateAfterCallBack="True"
                                        CommandName="cmdcofinanciacion">COFINANCIACION</anthem:LinkButton>
                                </DataItemTemplate>
                            </dxwgv:GridViewDataHyperLinkColumn>
                            <dxwgv:GridViewDataHyperLinkColumn Caption="Entidades Programas" Visible="False"
                                VisibleIndex="12">
                                <DataItemTemplate>
                                    <anthem:LinkButton ID="lnkEntidadesProgramas" runat="server" CommandName="cmdEntidadesProgramas">Entidades</anthem:LinkButton>
                                </DataItemTemplate>
                            </dxwgv:GridViewDataHyperLinkColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Estado" FieldName="PRG_ESTADO" VisibleIndex="10">
                            </dxwgv:GridViewDataTextColumn>
                        </Columns>
                        <Settings ShowGroupPanel="True" ShowFilterRow="True" ShowFilterRowMenu="True" />
                        <SettingsCustomizationWindow Enabled="True" />
                        <SettingsPager>
                            <AllButton Text="All">
                            </AllButton>
                            <NextPageButton Text="Siguiente &gt;">
                            </NextPageButton>
                            <PrevPageButton Text="&lt; Anterior">
                            </PrevPageButton>
                            <Summary Text="P&#225;gina {0} de {1} ({2} items)" />
                        </SettingsPager>
                        <SettingsText GroupPanel="Arrastre aqui las columnas que desea agrupar" Title="Planes y Programas" />
                        <SettingsCookies Enabled="True" />
                        <ImagesFilterControl>
                            <LoadingPanel Url="~/App_Themes/PlasticBlue/Editors/Loading.gif">
                            </LoadingPanel>
                        </ImagesFilterControl>
                        <StylesEditors>
                            <CalendarHeader Spacing="11px">
                            </CalendarHeader>
                            <ProgressBar Height="25px">
                            </ProgressBar>
                        </StylesEditors>
                    </dxwgv:ASPxGridView>
                    </anthem:Panel>


     <dx:ASPxGridViewExporter ID="gridExport" runat="server" GridViewID="gridPlanesProgramas">
    </dx:ASPxGridViewExporter>
                    <asp:Button ID="btnXlsExport" runat="server" CssClass="button m tp-space10" OnClick="btnXlsExport_Click"
                        Text="Exportar a XLS" />
            
    
    
            
</asp:Content>
